//string 数据替换
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;

    s="Hello woooorld";
    //从索引7开始，替换五个字符为"or"
    s.replace(7,5,"or");
    cout<<s<<endl;

    s="Hello woooorld";
    //从索引7到11,使用迭代器来指定范围
    s.replace(s.begin()+7,s.begin()+12,"or");
    cout<<s<<endl;

    //带长度限制的替换
    s="Hello woooorld";
    s.replace(s.begin()+7,s.begin()+12,"orajkhsdciakjgu",2);
    cout<<s<<endl;

}